package haemers.reflection.tests 
{
	import flash.utils.describeType;
	import haemers.reflection.data.vo.VariableVO;
	import nl.haemers.data.reflection.Variables;
	import org.flexunit.Assert;
	/**
	 * ...
	 * @author Jonathan
	 */
	public class VariablesTest 
	{
		private var _mockData:VariableVO;
		private var _description:XML;
		private var _variables:Variables;
		
		/** Public methods **/
		[Before]
		public function setup() : void
		{
			_mockData = new VariableVO();
			_description = describeType(_mockData);
			_variables = new Variables(_description);
			trace(_description);
		}
		
		[Test]
		public function testCollection() : void
		{
			Assert.assertNotNull(_variables.getVariables());
			Assert.assertNotNull(_variables.getVariables()["id"]);
		}
		
		[Test]
		public function testLookUp() : void
		{
			Assert.assertNotNull(_variables.getVariable("id"));
			Assert.assertTrue(_variables.hasVariable("id"));
			
			Assert.assertTrue(_variables.hasVariable("ignoredProperty"));
		}
		
		[Test]
		public function testSerializeName() : void
		{
			Assert.assertFalse(_variables.hasVariable("nested"));
			Assert.assertTrue(_variables.hasVariable("child"));
			
			Assert.assertNull(_variables.getVariable("nested"));
			Assert.assertNotNull(_variables.getVariable("child"));
		}
		
		[After]
		public function teardown() : void
		{
			_description = null;
			_mockData = null;
			_variables = null;
		}
		/** Getters & Setters **/
		
		/** Protected methods **/
		
		/** Private methods **/
	}

}